﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

namespace Tebbee.Business.Server.Common.IO
{
    public class FileIO
    {
        public static bool WriteFile(string saveString, string path)
        {
            try
            {
                StreamWriter sw = new StreamWriter(path);
                sw.Write(saveString);
                sw.Close();
                sw.Dispose();
                return true;
            }
            catch (Exception ex) 
            {

                return false;
                throw new Exception(ex.Message, ex);
            }
        }

        public static string ReadFile(string path)
        {
            string content;
            if (String.IsNullOrEmpty(path)) return "";
            try
            {
                StreamReader sr = new StreamReader(path);
                content = sr.ReadToEnd();
                sr.Close();
                sr.Dispose();
            }
            catch (Exception ex) 
            {

                throw new Exception(ex.Message,ex);
            }
            return content;
        }
    }
}